<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="CentOS 安装配置 2, 个人博客">
    <meta name="description" content="CentOS安装配置 2MySQL 数据库的安装MySQL数据库最早就是在Linux环境下发展起来的，而且在国内也是使用最多的一种数据库，那么本次对MySQL的安装与配置进行讲解。只需要登录MySQL官网就可以下载Linux版本：https">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>CentOS 安装配置 2 | 个人博客</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">
    
    <script src="/libs/jquery/jquery.min.js"></script>
    
</head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper head-container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">个人博客</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>

<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">个人博客</div>
        <div class="logo-desc">
            
            Never really desperate, only the lost of the soul.
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/BuddyXiao" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>

        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/BuddyXiao" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/3.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">CentOS 安装配置 2</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        height: calc(100vh - 250px);
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #toc-content .is-active-link::before {
        background-color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/centos/">
                                <span class="chip bg-color">centos</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/IT/" class="post-category">
                                IT
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-03-01
                </div>
                

                

                

                

                
            </div>

        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <h1 id="CentOS安装配置-2"><a href="#CentOS安装配置-2" class="headerlink" title="CentOS安装配置 2"></a>CentOS安装配置 2</h1><h2 id="MySQL-数据库的安装"><a href="#MySQL-数据库的安装" class="headerlink" title="MySQL 数据库的安装"></a>MySQL 数据库的安装</h2><p>MySQL数据库最早就是在Linux环境下发展起来的，而且在国内也是使用最多的一种数据库，那么本次对MySQL的安装与配置进行讲解。只需要登录MySQL官网就可以下载Linux版本：<a href="https://dev.mysql.com/downloads/mysql/" target="_blank" rel="noopener">https://dev.mysql.com/downloads/mysql/</a></p>
<ol>
<li>【FTP开发包上传】如果要想进行组件的安装，那么实际上有两种做法：</li>
</ol>
<ul>
<li><p>如果你的系统在云服务主机之中，那么可以直接利用wget命令下载MySQL数据库</p>
<pre><code class="shell">wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz</code></pre>
</li>
<li><p>使用ftp上传，利用fileZilla等工具，直接将文件拖到目标目录下</p>
</li>
</ul>
<ol start="2">
<li><p>【组件解压缩】</p>
<pre><code>对于&quot;.tar.xz&quot;文件需要进行两次解压
xz文件解压缩：xz -d /var/ftp/mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz
tar文件解压缩：tar xvf /var/ftp/mysql-8.0.17-linux-glibc2.12-x86_64.tar -C /usr/local/
目录更名：mv /usr/local/mysql-8.0.17-linux-glibc2.12-x86_64/ /usr/local/mysql</code></pre></li>
<li><p>【创建用户】如果要想使用MySQL服务则一定要提供有一个mysql的账户同时这个账户一定要加入到mysql组里面，为了保证安全还必须mysql账户不能够进行系统的登录：</p>
<pre><code>创建用户组
groupadd mysql
创建用户
useradd -r -g mysql -s /bin/false mysql
授权配置
chown -R mysql:mysql ./</code></pre></li>
<li><p>【创建数据目录】如果要使用MySQL则一定要对MySQL数据库里面数据设置有一个专属的数据目录，实际的开发中，将此目录配置到相应的数据盘里面，本次为了模拟方便，会将MySQL直接配置到”/usr/data/mysql”目录</p>
<pre><code class="shell">创建目录
mkdir -p /usr/data/mysql/{db,logs}
目录授权
chmod -R 777 /usr/data/mysql</code></pre>
</li>
<li><p>【卸载mariadb】在默认情况下CentOS系统内部会自动安装MariaDB数据库的安装，所以如果要想安装MySQL建议手工删除掉此组件</p>
<ul>
<li>查看系统是否装有MariaDB</li>
</ul>
<pre><code class="shell">rpm -qa | grep mariadb</code></pre>
<ul>
<li>卸载自动安装好的MariaDB</li>
</ul>
<pre><code class="shell">rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64</code></pre>
</li>
<li><p>【MySQL配置文件】如果要想使用MySQL则需要创建有一个配置文件：</p>
<pre><code class="shell">打开配置文件
vi /etc/my.cnf</code></pre>
<pre><code class="yaml">配置文件内容

[mysqld]
# 设置3306端口
port = 3306 
# 设置mysql的安装目录
basedir=/usr/local/mysql
# 设置mysql数据库的数据的存放目录
datadir=/usr/data/mysql/db
# mysqlsock存储目录
socket=/usr/data/mysql/db/mysql.sock
# 允许最大连接数
max_connections=10000
# 允许连接失败的次数，这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB 
# 默认使用“mysql_native_password”插件认证
default-authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8 
# mysqlsock 存储目录
socket=/usr/data/mysql/db/mysql.sock
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8
[mysqld_safe]
log-error=/usr/data/mysql/logs/mysql.log
pid-file=/usr/data/mysql/mysql.pid
# mysqlsock 存储目录
socket=/usr/data/mysql/db/mysql.sock</code></pre>
</li>
<li><p>【安装MySQL】此时配置完成之后就可以进行MySQL数据库的安装了：</p>
<pre><code class="shell">/usr/local/mysql/bin/mysqld --initialize --console
会有一个初始化密码(冒号后的内容)形如 root@localhsot: d/nnri9&gt;7&gt;iM</code></pre>
<p>当此时的初始化执行完毕之后就会直接在控制台上打印初始化信息，同时会有在相应的数据目录里面保存有相关的文件内容</p>
</li>
<li><p>【启动MySQL】MySQL服务初始化之后就可以考虑进行MySQL数据库的服务启动：</p>
<pre><code class="shell">/usr/local/mysql/bin/mysqld_safe --user=root &gt; /dev/null 2&gt;&amp;1 &amp;</code></pre>
<table>
<thead>
<tr>
<th>前台启动</th>
<th>/usr/local/mysql/bin/mysqld_safe –user=root</th>
</tr>
</thead>
<tbody><tr>
<td>后台启动</td>
<td>/usr/local/mysql/bin/mysqld_safe –user=root &gt; /dev/null 2&gt;&amp;1 &amp;</td>
</tr>
</tbody></table>
</li>
<li><p>【MySQL控制台】当MySQL服务启动之后就可以直接进入到MySQL控制台，用户名：root,密码为初始化密码：</p>
<pre><code class="shell">/usr/local/mysql/bin/mysql -uroot -p
输入初始化密码，即可登录成功</code></pre>
</li>
<li><p>【修改密码】当登录到MySQL数据库之后就可以考虑对当前的root账户密码进行修改，本次修改的密码为”mysqladmin”:</p>
<pre><code class="mysql">alter user &#39;root&#39;@&#39;localhost&#39; IDENTIFIED WITH mysql_native_password BY &#39;mysqladmin&#39;;</code></pre>
</li>
<li><p>【远程授权】此时的root账户只能够在本机进行访问，无法通过远程连接的模式进行访问，所以需要对root授权：</p>
<pre><code class="mysql">进入到mysql的数据库
use mysql
设置远程访问
update user set user.Host=&#39;%&#39; where user.User=&#39;root&#39;;
配置保存
flush privileges;</code></pre>
</li>
<li><p>【连接测试】直接在本机上使用MySQL客户端进行连接测试</p>
</li>
<li><p>【SQL语句】既然可以正常连接到远程的MySQL数据库，所以这个时候可以考虑进行数据库与数据表的创建。</p>
<pre><code class="MYSQL">CREATE DATABASE test_connection CHARACTER SET UTF8;

USE test_connection;

CREATE TABLE news(
    nid        BIGINT        AUTO_INCREMENT,
    title    VARCHAR(200),
    note    TEXT,
    CONSTRAINT pk_nid PRIMARY KEY(nid)
) engine=innodb;

INSERT INTO news(title,note) VALUES(&quot;你好&quot;,&quot;www.fengfeng.com&quot;);

SELECT * FROM news LIMIT 0,3;

SELECT LAST_INSERT_ID();</code></pre>
</li>
<li><p>【数据库加密】现在所有MySQL中的数据内容全部都保存在了”/usr/data/mysql”目录里面，所以为了保证数据的安全，如果有需要可以直接进行目录的加密处理：</p>
<pre><code class="shell">/usr/local/mysql/bin/mysql_ssl_rsa_setup --datadir=/usr/data/mysql/db/</code></pre>
</li>
</ol>
<h2 id="JDK安装与配置"><a href="#JDK安装与配置" class="headerlink" title="JDK安装与配置"></a>JDK安装与配置</h2><p>​    有两种方式安装，一种是直接使用yum命令直接进行安装(openjdk)，另一种直接通过oracle官方网站下载相应的JDK版本</p>
<ol>
<li><p>【FTP上传】下载好对应JDK版本后，通过FTP进行文件的上传</p>
</li>
<li><p>【解压缩】JDK给定的文件可以直接进行解压缩的控制，将其解压缩到”usr/local”目录中：</p>
<pre><code class="shell">tar xzvf /var/ftp/jdk-8u161-linux-x64.tar.gz -C /usr/local/</code></pre>
</li>
<li><p>【目录更名】为了方便后续的配置处理，本次将解压缩之后的JDK进行重命名：</p>
<pre><code class="shell">mv /usr/local/jdk-8u161/ /usr/local/jdk</code></pre>
</li>
<li><p>【环境配置】此时的JDK属于一个独立的组件，所以如果要想使用，还需要进行系统环境的配置：</p>
<pre><code class="shell">打开配置文件
vi /etc/profile
在文件最后添加
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin:
使文件配置生效
source /etc/profile</code></pre>
</li>
<li><p>【验证】直接输入”java -version”命令即可</p>
<p>成功后，此时JDK的配置就完成了，而后基于JDK开发的组件也就可以进行配置了</p>
</li>
</ol>
<h2 id="Tomcat安装与配置"><a href="#Tomcat安装与配置" class="headerlink" title="Tomcat安装与配置"></a>Tomcat安装与配置</h2><p>Tomcat是在Java行业之中鼎鼎大名的WEB服务器，其本身也是基于JDK开发的，所以一定要保证系统里面已经配置了JDK环境后才可以进行Tomcat服务的安装与使用，如果要想使用Tomcat则可以直接登录<a href="https://tomcat.apache.org/" target="_blank" rel="noopener">https://tomcat.apache.org/</a>  站点进行Tomcat组件的下载</p>
<ol>
<li><p>【FTP上传】可以直接通过FTP进行组件的上传，或者直接使用wget命令下载：</p>
<pre><code class="shell">进入下载目录
cd var/ftp
下载软件包
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.22/bin/apache-tomcat-9.0.22.tar.gz</code></pre>
</li>
<li><p>【解压缩】下载得到的Tomcat进行一个解压缩：</p>
<pre><code class="shell">tar xzvf /var/ftp/apache-tomcat-9.0.22.tar.gz -C /usr/local/</code></pre>
</li>
<li><p>【目录更名】为了方便配置，可以将目录做一个简化更名处理：</p>
<pre><code class="shell">mv /usr/local/apache-tomcat-9.0.22 /usr/local/tomcat</code></pre>
</li>
<li><p>【修改端口】默认的Tomcat组件的端口是8080，现在将其修改为80：</p>
<pre><code>vi /usr/local/tomcat/conf/server.xml</code></pre><pre><code class="xml">修改位置内容
&lt;Connector executor=&quot;tomcatThreadPool&quot; port=&quot;80&quot; protocol=&quot;HTTP/1.1&quot; connectionTimeout=&quot;20000&quot; redirectPort=&quot;8443&quot; /&gt;</code></pre>
</li>
<li><p>【内存调整】Tomcat本身基于JDK的操作，所以需要设置合理的内存：</p>
<pre><code class="shell">vi /usr/local/tomcat/bin/catalina.sh</code></pre>
<pre><code>添加内容
JAVA_OPTS=&#39;-Xms1g -Xmx1g&#39;</code></pre></li>
<li><p>【Tomcat命令】现在Tomcat配置完成之后就可以通过给定的shell脚本进行Tomcat的启动与关闭：</p>
<table>
<thead>
<tr>
<th>启动Tomcat</th>
<th>/usr/local/tomcat/bin/catalina.sh  start</th>
</tr>
</thead>
<tbody><tr>
<td>关闭Tomcat</td>
<td>/usr/local/tomcat/bin/catalina.sh  stop</td>
</tr>
</tbody></table>
<p>当服务启动完成之后可以直接使用<code>netstat -nptl</code>命令查看80端口</p>
</li>
<li><p>【Java进程】Tomcat本身是一个Java进程，当JDK安装成功之后可以直接使用”jps”命令查看所有的Java相关进程</p>
</li>
<li><p>【浏览器访问】既然Tomcat已经可以成功的启动，那么就可以在外部通过浏览器进行web服务的访问：</p>
<p>浏览器地址栏：<a href="http://192.168.255.130/" target="_blank" rel="noopener">http://192.168.255.130/</a></p>
</li>
</ol>
<h2 id="SVN版本控制"><a href="#SVN版本控制" class="headerlink" title="SVN版本控制"></a>SVN版本控制</h2><p>在实际项目开发过程之中，版本控制工具肯定是不可或缺的重要技术支持环节</p>
<ol>
<li>【获取组件】SVN服务端组件默认情况下不会在系统之中进行安装，所以需要通过yum命令远程安装：</li>
</ol>
<pre><code class="shell">yum -y install subversion</code></pre>
<ol start="2">
<li>【工作目录】如果要想使用SVN进行版本控制，则一定要创建有一个数据文件的存储目录：</li>
</ol>
<pre><code class="shell">mkdir -p usr/data/svn/fengfeng</code></pre>
<p>以后每一个项目都需要在”svn”目录下面创建不同的子目录分开进行保存</p>
<ol start="3">
<li>【目录初始化】如果要想将创建的目录设置为SVN工作目录则还需要进行初始化的操作：</li>
</ol>
<pre><code class="shell">svnadmin create /usr/data/svn/fengfeng/</code></pre>
<p>一旦初始化完成，该目录下会包含有许多的配置文件信息，而这些配置文件肯定需要由开发者自己进行修改。</p>
<ol start="4">
<li>【修改SVN 服务配置】所有的配置项都在”svnserve.conf”文件里面定义：</li>
</ol>
<pre><code class="shell">打开文件
vi /usr/data/svn/fengfeng/conf/svnserve.conf
并配置以下信息</code></pre>
<table>
<thead>
<tr>
<th align="left">anon-access = read</th>
<th>允许匿名用户读取文件</th>
</tr>
</thead>
<tbody><tr>
<td align="left">auth-access = write</td>
<td>授权访问才可以进行内容写入</td>
</tr>
<tr>
<td align="left">password-db = passwd</td>
<td>认证信息配置存储文件</td>
</tr>
<tr>
<td align="left">authz-db = authz</td>
<td>授权配置文件</td>
</tr>
</tbody></table>
<ol start="5">
<li>【认证配置】随后需要进行认证信息的定义：</li>
</ol>
<pre><code class="shell">打开文件
vi /usr/data/svn/fengfeng/conf/passwd
设置用户密码
fengfeng = happy</code></pre>
<ol start="6">
<li>【授权配置】为fengfeng用户授权：</li>
</ol>
<pre><code class="shell">打开文件
vi /usr/data/svn/fengfeng/conf/authz</code></pre>
<pre><code>配置信息（添加）
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/0=Snake Oil, Ltd./OU=Reserch Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&amp;joe
[/]
fengfeng=rw
# [/foo/bar]
# harry = rw
# &amp;joe = r
# * = 
fengfeng=rw
* =
# [repository:/bar/fuz]
# @harry_and_sally = rw
# * = r
* = r</code></pre><ol start="7">
<li>【服务启动】当一切部署完成之后就可以直接利用svn命令启动服务：</li>
</ol>
<pre><code class="shell">svnserve -d -r /usr/data/svn/fengfeng/</code></pre>
<ol start="8">
<li>【测试】服务启动完成之后就可以直接使用任意的SVN客户端进行连接测试</li>
</ol>

            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="http://yoursite.com" rel="external nofollow noreferrer">肖和锋</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="http://yoursite.com/2020/03/01/centos%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE2/">http://yoursite.com/2020/03/01/centos%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE2/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="http://yoursite.com" target="_blank">肖和锋</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/centos/">
                                    <span class="chip bg-color">centos</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">

<div id="article-share">
    
    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/medias/reward/wechat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>
            
        </div>
    </div>

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="far fa-dot-circle"></i>&nbsp;本篇
            </div>
            <div class="card">
                <a href="/2020/03/01/centos%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE2/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/3.jpg" class="responsive-img" alt="CentOS 安装配置 2">
                        
                        <span class="card-title">CentOS 安装配置 2</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            CentOS安装配置 2MySQL 数据库的安装MySQL数据库最早就是在Linux环境下发展起来的，而且在国内也是使用最多的一种数据库，那么本次对MySQL的安装与配置进行讲解。只需要登录MySQL官网就可以下载Linux版本：https
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-03-01
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/IT/" class="post-category">
                                    IT
                                </a>
                            
                            
                        </span>
                    </div>
                </div>

                
                <div class="card-action article-tags">
                    
                    <a href="/tags/centos/">
                        <span class="chip bg-color">centos</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2020/03/01/centos%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE1/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/2.jpg" class="responsive-img" alt="CentOS 安装配置 1">
                        
                        <span class="card-title">CentOS 安装配置 1</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            Centos安装配置 1简单修改
【创建虚拟机的配置】如果要想在虚拟机进行CentOS系统的安装，则一定要创建由一个新的虚拟机环境，同时在安装的过程之中尽可能提供较大的内存以及较多的CPU，可以让安装过程快速一些（本次选择的最小安装版本，是
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-03-01
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/IT/" class="post-category">
                                    IT
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/centos/">
                        <span class="chip bg-color">centos</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>



    <footer class="page-footer bg-color">
    <div class="container row center-align" style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">2019</span>
            <a href="http://yoursite.com" target="_blank">肖和锋</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/BuddyXiao" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1464078415@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1464078415" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1464078415" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/" + "search.xml", 'searchInput', 'searchResult');
});
</script>
    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Global site tag (gtag.js) - Google Analytics -->


    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    

    

    
    <script type="text/javascript" src="/libs/background/ribbon-dynamic.js" async="async"></script>
    
    
    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
